home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of Shareware
/
Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso
/
mac
/
ZIPPED
/
DOS
/
CAD_CAM
/
WCEDT202.ZIP
/
COMPILE.LSP
next >
Wrap
Text File
|
1992-08-29
|
11KB
|
343 lines
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ATTENTION: FOR ADS - C programmers ONLY!
;;;
;;;
;;;
;;; This is a set of AutoLISP routines which will help you to design
;;; quick and painless ADS applications WITHIN AutoCAD. Currently, there
;;; is no way of implementing a debugger with this method, however, debuggers
;;; should be used sparingly.
;;;
;;;
;;; SPECIAL IMPORTANT INFORMATION
;;; If you are using a real mode compiler you may be able to avoid this step.
;;;
;;; You will need approximately 10 megs of memory to be able to run
;;; a 386 compiler out of AutoCAD.
;;;
;;; Use a memory manager to create expanded memory for ALOT or ALL of your
;;; memory.
;;; Example line of config.sys
;;; ********
;;; DEVICE=C:\QEMM\QEMM386.SYS RAM ROM AROM=C800-CFFF
;;; ********
;;;
;;; In order to run protected mode applications from within AutoCAD it is
;;; necessary that you configure AutoCAD to leave some room to work with.
;;; Use maxvcpi switch to allow plenty of extra space for your 386 linker
;;; and/or 386 compiler. Use intmap 08h.
;;;
;;; Create a batch file and include the following lines:
;;; ********
;;; cfig386 acad -clear -swapchk OFF -minswfsize 400000 -swapdefdisk
;;; cfig386 acad -intmap 08h -vscan 20000 -maxvcpi 5000000 -swapdir C:\SWAP
;;; ********
;;;
;;; Run the batch file to reconfigure AutoCAD.
;;;
;;; Note: Depending upon your system and available memory, you may have
;;; to play with these values a bit to get the correct results.
;;;
;;; Upon loading this file, the following functions are defined:
;;;
;;; C:RUN - Used as an alternative method <other than internal calls>
;;; run/test a function.
;;;
;;; COMPILE - This function will 1st check to see if the current file
;;; has a 'C' extension on it. If so, then the function will
;;; call the CPILE command <as specified in ACAD.PGP> to
;;; compile current 'C' module. All output from the compiler
;;; is sent to file filename.ERR. A subsequent view of the
;;; error file then takes place. If you are using the
;;; MetaWare compiler, you may at this point high light the
;;; error line <Numbers only> and be placed strategically in
;;; your source file at the error or warning listed at that
;;; point.
;;;
;;; CYCLE - This calls the COMPILE, LINK and RELOAD functions one
;;; at a time, prompting for continuance at each phase.
;;;
;;; LINK - This will call the linker <as specified in ACAD.PGP> to
;;; link up the application. Currently, the link call uses
;;; a response file for linking up the app. The name of the
;;; response file is assumed to be LINK.RSP.
;;; REMOUT - Simple function to add wrapping comment marks to the
;;; current line.
;;; Example:
;;; i = 1;
;;; becomes
;;; /* i = 1; */
;;;
;;; UNREM - Simple function to remove wrapping comment marks from the
;;; current line.
;;; Example:
;;; /* i = 1; */
;;; becomes
;;; i = 1;
;;;
;;;
;;; The linking process requires you to include a command
;;; to your acad.pgp to call the linker. The ACAD command name
;;; used in COMPILE.LSP is LINKER.
;;;
;;; Example, using Pharlaps linker:
;;;
;;; LINKER,386LINK, 500000,*,0
;;;
;;; The compiling process requires you to include a command
;;; to your acad.pgp to call the compiler. The ACAD command name
;;; used in COMPILE.LSP is CPILE.
;;;
;;; Example, using MetaWares compiler/driver:
;;; CPILE,HC386, 500000,*,0
;;;
;;;
;;; To setup, either use the setqs calls at the top of the
;;; file, or run the c:cset program to set the string variables.
;;; These 2 variables are
;;;
;;; loadfile - This is the file which is to be unload and reloaded
;;; upon each working cycle. Typically, during ADS development, the
;;; application must be unloaded and reload again using AutoLISPs
;;; (Xunload loadfile) and (Xload loadfile) functions.
;;;
;;; runname - This is the function name which will be tested upon
;;; for running as well as checking to verify whether the EXP has
;;; been loaded or unloaded. If, for example, your were writing an
;;; application to replace AutoCADs circle command, you would most
;;; likely call the command C:CIRCLE.
;;;
;;; Modify this file as you see fit.
;;;
(if(not wcedit)
(progn
(princ "WCEdit Version 2.0 must first be loaded\n")
(quit)
)
)
;;; You may use these lines, or run CSET below. ;;;
(setq loadfile nil)
(setq runname nil)
;;; Alter func names and default key strokes to suite your needs ;;;
(wcconfig "c:run" (wc_gkey "Ctrl R") "Run the application")
(wcconfig "cycle" (wc_gkey "Alt F10") "Compile,Link,Reload and Run")
(wcconfig "link" (wc_gkey "Ctrl Q") "Link the application")
(wcconfig "compile" (WC_gkey "Alt F10") "Compile this module")
(wcconfig "unrem" (wc_gkey "Alt .") "Un-remout ' '")
(wcconfig "remout" (wc_gkey "Alt /") "Remout line using ' '")
(defun c:cset()
(setq loadfile(wc_fetch_string
""
" Escape to quit "
" Enter the loading filename (EXP) without extension " ))
(if loadfile
(progn
(setq runname(wc_fetch_string
""
" Escape to quit "
" Enter the Lisp calling name of function to test " ))
(if runname
(wc_message "Setup is complete." 0)
)
)
)
)
(defun c:cls()
(textscr)
(wc_cls)
(prin1)
)
(defun c:rel(/ mode)
(if (eval runname)
(xunload loadfile)
)
(xload loadfile)
(prin1)
)
(defun c:run(/ mode)
(setq mode(nth 19 (wc_statistics)))
(if (eval runname)
(progn
(setvar "cmdecho" 0)
(wc_setmode_now 0)
(eval(list runname))
(if(/= mode 25)
(wc_setmode_now 1)
)
(wc_beep 5000.0 20000.0)
(wc_print "* Last run complete *" )
(prin1)
)
)
)
(defun unrem(/ owait found)
(wc_silent 1)
(wc_trigger "BEGIN_LINE_MARK")
(wc_trigger "END_MARK")
(setq x(wc_col -1.0))
(setq y(wc_row -1.0))
(wc_col 0.0)
(wc_find_replace "/*" "" 1)
(wc_find_replace "*/" "" 1)
(wc_trigger "erase_marks")
(wc_clean_right)
(wc_col x)
(wc_row y)
(wc_col 0.0)
(wc_move_down 1.0)
(wc_silent 0)
(prin1)
)
(defun remout(/ owait found)
(wc_silent 1)
(wc_clean_right)
(unrem)
(wc_move_up 1.0)
(wc_col 0.0)
(setq ch(wc_get_char))
(if(= ch " ")
(setq str(wc_next_word))
(setq str "NO NEXT")
)
(if(= (type str) 'STR)
(if(> (strlen str) 0)
(progn
(wc_stuff_char "/")
(wc_move_right 1.0)
(wc_stuff_char "*")
(wc_race_end 0)
(wc_stuff_char "*")
(wc_move_right 1.0)
(wc_stuff_char "/")
)
)
)
(wc_silent 0)
(wc_col 0.0)
(wc_move_down 1.0)
(wc_refresh 0)
(prin1)
)
(defun wheredot(nname / flag i len)
(setq len(strlen nname)i 1 flag 't)
(while flag
(if(= (substr nname i 1) ".")
(setq flag nil)
(setq i (+ 1 i))
)
(if (>= i len)
(setq flag nil i nil)
)
)
i
)
(defun verr(name / oname)
(wc_trigger "GETERROR");
)
(defun link(/ row col)
(setq row(wc_row -1.0)col(wc_col -1.0))
(wc_race_home 1)
(setvar "CMDECHO" 0)
(wc_print "Linking ... ")
(command "linker" "@link.rsp > link.err")
(wc_view_file "link.err")
(wc_refresh 1);
(wc_print "Linking process completed.")
(prin1)
)
(defun cycle(/ row col)
(setq row(wc_row -1.0)
col(wc_col -1.0))
(wc_race_home 1)
(setvar "CMDECHO" 0)
(setq _clean_ nil)
(compile)
(setq ans(wc_message "Continue with link <Y = Enter>" 0))
(if(= ans (wc_gkey "Enter"))
(progn
(link)
(setq ans(wc_message "Continue with reload <Y = Enter>" 0))
(if(= ans (wc_gkey "Enter"))
(progn
(c:rel)
)
)
)
)
(wc_print "Cycle");
)
(defun compile(/ );name i leadname tail str flag ename col row)
(setvar "CMDECHO" 0)
(setq name(gcname) flag nil)
(if(setq i (wheredot name))
(progn
(setq leadname(substr name 1 (- i 1)))
(setq tail(substr name (+ 1 i) 100))
(if(and(= (type leadname)'STR)(=(type tail)'STR))
(if(= (strcase tail nil) "C")
(progn
(wc_hard_write)
(setq ename (strcat leadname ".err"))
(setq str(strcat "-c " name " >" ename))
(COMMAND "cpile" str)
(wc_refresh 1)
(verr ename)
(wc_print "COMPILE");
(if _clean_
(progn
(WC_TRIGGER "QUIT")
(C:WC)
)
)
(setq flag 't)
)
)
)
)
)
(if(not flag)
(wc_message "Error in filename or invalid file type." 0)
)
(prin1)
)
(defun viewerr(/ name i leadname tail str flag ename)
(setq name(gcname) flag nil)
(if(setq i (wheredot name))
(progn
(setq leadname(substr name 1 (- i 1)))
(setq tail(substr name (+ 1 i) 100))
(if(and(= (type leadname)'STR)(=(type tail)'STR))
(if(= (strcase tail nil) "C")
(progn
(wc_hard_write)
(setq ename (strcat leadname ".err"))
(setq str(strcat "-c " name " >" ename))
(if (findfile ename)
(verr ename)
)
)
)
)
)
)
)
(prin1)